home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / terms / kermit / b / ckoins.cmd < prev    next >
Encoding:
Text File  |  1993-07-17  |  28.7 KB  |  956 lines

  1. /*
  2.   File INSTALL.CMD (CKOINS.CMD)
  3.  
  4.   Last update: Sat Jul 17 11:17:52 1993
  5.  
  6.   A Rexx Program to install OS/2 C-Kermit 5A(189).
  7.   Written by Jeffrey Altman, Altmania Productions,
  8.   and Frank da Cruz, Columbia University, June 1993.
  9.   All rights assigned to Columbia University.
  10.  
  11.   Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New
  12.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  13.   sold for profit as a software product itself, nor may it be included in or
  14.   distributed with commercial products or otherwise distributed by commercial
  15.   concerns to their clients or customers without written permission of the
  16.   Office of Kermit Development and Distribution, Columbia University.  This
  17.   copyright notice must not be removed, altered, or obscured.
  18. */
  19.  
  20. /*
  21.   All the files to be installed must be in the same directory as INSTALL.CMD.
  22.   This script:
  23.  
  24.   . Installs either the 16-bit or 32-bit version of C-Kermit
  25.     depending on the version of OS/2 being used, and which one(s)
  26.     is/are on the install disk.
  27.  
  28.   . Creates a directory for C-Kermit if necessary.
  29.  
  30.   . Creates a C-Kermit program object on the OS/2 2.x Desktop.
  31.  
  32.   . Customizes the CKERMOD.INI file according to the user's preferences.
  33.  
  34.   . Installs the dummy TCP/IP DLL, CKOTCP.DLL, only if needed.
  35.  
  36.   . Update the CONFIG.SYS file only at the user's request.
  37. */
  38.  
  39. /* Load RexxUtil if available */
  40. RexxUtils = 1
  41. SIGNAL ON SYNTAX NAME NoRexxUtil
  42. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' 
  43. CALL SysLoadFuncs
  44.  
  45. SAY "RexxUtils installed. :-)"
  46. CALL ENDSIGNAL
  47.  
  48. NOREXXUTIL:
  49. SAY "RexxUtils not installed. :-("
  50. CALL RxFuncDrop 'SysLoadFuncs'
  51. RexxUtils = 0
  52.  
  53. ENDSIGNAL:
  54. SIGNAL OFF SYNTAX
  55.  
  56. /* Determine OS/2 Version */
  57. IF RexxUtils
  58.   THEN OS2Ver = SysOS2Ver()
  59.   ELSE OS2Ver = 1.x           
  60. /* We assume this because RexxUtils is missing and Rexx is installed */
  61. /* I have no other way of determining what the version is without    */
  62. /* SysOS2Ver()                                                       */
  63.  
  64. /* Determining Boot information */
  65. IF RexxUtils
  66.   THEN bootpath = SysSearchPath( 'DPATH', 'COUNTRY.SYS' )
  67.   ELSE bootpath = MySearchPath( 'DPATH', 'COUNTRY.SYS' )
  68. bootdrive = FILESPEC( "drive", bootpath )
  69.  
  70. /* Save Current Directory and change to Source Directory */
  71. startdir = DIRECTORY()
  72. PARSE SOURCE system calltype command
  73. drive = FILESPEC( "DRIVE", command )
  74. path = FILESPEC( "PATH", command )
  75. IF SUBSTR( path, LENGTH(path), 1 ) = '\'
  76.   THEN sourcedir = DIRECTORY( drive || SUBSTR( path, 1, LENGTH(path)-1 ) )
  77.   ELSE sourcedir = DIRECTORY( drive || path )
  78.  
  79. /* SpaceRequired is the amount of free space required to install C-Kermit */
  80. IF RexxUtils
  81.   THEN DO
  82.     spacerequired = 0
  83.     rc = SysFileTree( '*.*', 'file', 'F' )
  84.     DO i = 1 to file.0
  85.       PARSE VAR file.i date time size atts name
  86.       spacerequired = spacerequired + 1024 + size
  87.       END
  88.     END
  89.   ELSE spacerequired = 720000 
  90.  
  91. /* Clear screen and prompt user for drive and path */
  92. '@echo off'
  93. IF RexxUtils
  94.   THEN CALL SysCls
  95.   ELSE "CLS" 
  96.  
  97. SAY "*********************************************************"
  98. SAY "*  Welcome to the OS/2 C-Kermit Installation Procedure. *"
  99. SAY "*  You are about to install C-Kermit on your computer.  *"
  100. SAY "*  Press <Ctrl-C> to cancel at any time.                *"
  101. SAY "*********************************************************"
  102.  
  103. /* Is IBM TCP/IP installed? */
  104. etcpath = VALUE( "ETC", , "OS2ENVIRONMENT" )
  105. len = LENGTH(etcpath) 
  106. IF len = 0 
  107.   THEN tcpip = 0
  108. ELSE DO
  109.   IF SUBSTR( etcpath, len, 1 ) = ';'
  110.     THEN DO
  111.       etcpath = SUBSTR( etcpath, 1, len - 1 )
  112.       len = len - 1
  113.     END
  114.   IF SUBSTR( etcpath, len, 1 ) = '\'
  115.     THEN DO
  116.       etcpath = SUBSTR( etcpath, 1, len - 1 )
  117.       len = len - 1
  118.     END
  119.   tcppath = SUBSTR( etcpath, 1, len - 3 )
  120.   IF RexxUtils
  121.     THEN DO 
  122.       CALL SysFileTree tcppath || "\dll\tcpipdll.dll", 'file', 'FO' 
  123.       tcpip = file.0
  124.     END
  125.   ELSE DO
  126.     CALL STREAM tcppath || "\dll\tcpipdll.dll", "C", "QUERY EXISTS" 
  127.     IF "\"RESULT <> "\"
  128.       THEN tcpip = 1
  129.       ELSE tcpip = 0
  130.   END
  131. END
  132. /* tcpip is now 1 if installed, or 0 if not */
  133.  
  134. GETDIR:
  135. SAY ""
  136. SAY "Please enter the complete path where you want C-Kermit to be installed."
  137. SAY "Just press the Enter key to accept the default path, C:\CKERMIT\..."
  138. IF SUBSTR(OS2Ver, 1, 1 ) > 1
  139.   THEN CALL CHAROUT ,">"
  140. PARSE PULL destination
  141.  
  142. /* Use default if nothing was entered */
  143. IF "\"destination = "\"
  144.   THEN destination = "C:\CKERMIT\"
  145.  
  146. /* Check to make sure there is a trailing backslash */
  147. IF SUBSTR( destination, LENGTH(destination), 1 ) <> "\"
  148.   THEN destination = destination || "\"
  149.  
  150. /* Check to make sure a drive is specified - use startup drive if not */
  151. installdrive = FILESPEC("DRIVE",destination)
  152. IF installdrive = ""
  153.   THEN installdrive = FILESPEC("DRIVE", startdir) 
  154.  
  155. /* Check to make sure a path is specified - use root if not */
  156. installpath  = FILESPEC("PATH", destination)
  157. IF installpath = ""
  158.   THEN installpath= "\"
  159.  
  160. /* Build fully qualified destination directory name */
  161. destination = installdrive || installpath 
  162.  
  163. /* And guaranteed-uppercase version */
  164. updest = TRANSLATE(destination)
  165.  
  166. /* And a version without a slash */
  167. destnoslash = SUBSTR( destination, 1, LENGTH( destination ) - 1 )
  168.  
  169. /* Ensure that source and destination directories are different */
  170. IF sourcedir"\" = TRANSLATE(destination)
  171.   THEN DO
  172.     SAY ""
  173.     SAY "The source and destination directories must be different."
  174.     CALL GETDIR
  175.   END
  176.  
  177. /* Validate the install drive */
  178. IF RexxUtils
  179.   THEN 
  180.     IF POS( TRANSLATE( installdrive ), "A: B: " || SysDriveMap() ) <> 0
  181.       THEN valid = 1
  182.       ELSE valid = 0
  183.   ELSE DO
  184.     'CMD /C DIR' installdrive '> NUL'
  185.     IF rc = 0
  186.       THEN valid = 1
  187.       ELSE valid = 0
  188.     END
  189. IF \ valid
  190.   THEN DO
  191.     SAY ""
  192.     SAY installdrive "is not a valid drive."
  193.     CALL GETDIR
  194.   END
  195.  
  196. /* Confirm destination directory */
  197. SAY ""
  198. SAY "You have asked that C-Kermit be installed in" destination || "."
  199. SAY "Is this correct? (Yes/No):"
  200. CALL Confirmation
  201. IF RESULT <> 'Y' 
  202.   THEN CALL GETDIR
  203. SAY ""
  204.  
  205. /* Check Available Drive Space */
  206. IF RexxUtils
  207.   THEN DO
  208.   PARSE UPPER VALUE SysDriveInfo( installdrive ) WITH sysinfodrive freespace,
  209.     drivesize volumelabel
  210.  
  211.   IF freespace < spacerequired 
  212.     THEN DO
  213.       SAY "Drive" installdrive "does not have enough free space for C-Kermit."
  214.       SAY "C-Kermit needs" spacerequired "bytes.  Drive" installdrive,
  215.         "only has" freespace "bytes free."
  216.       SAY "Enter 'Yes' to choose another drive, or 'No' to cancel."
  217.       CALL Confirmation
  218.       IF RESULT = 'Y'
  219.         THEN CALL GETDIR
  220.         ELSE DO
  221.           SAY ""
  222.           EXIT
  223.         END
  224.       END  
  225.   END /* RexxUtils */
  226.  
  227. SAY "Creating destination directory" destination || "..."
  228. IF RexxUtils
  229.   THEN rc = SysMkDir(SUBSTR(destination,1,LENGTH(destination)-1))
  230.   ELSE 'CMD /C MD' SUBSTR(destination,1,LENGTH(destination)-1) '> NUL'
  231.  
  232. SELECT
  233.   WHEN rc = 0 
  234.     THEN NOP
  235.  
  236.   WHEN ( rc = 5 & RexxUtils ) | ( rc = 1 & \ RexxUtils )
  237.     THEN DO
  238.       SAY "Directory" destination "already exists."
  239.       SAY "Enter 'Yes' to continue or 'No' to choose a new directory."
  240.       CALL Confirmation
  241.       IF RESULT <> 'Y'
  242.         THEN CALL GETDIR
  243.       SAY ""
  244.     END
  245.  
  246.   OTHERWISE 
  247.     DO
  248.       SAY "Can't create destination directory" destination
  249.       rc = DIRECTORY( startdir )
  250.       CALL GETDIR
  251.     END
  252. END
  253.  
  254. GETMODEM:
  255. SAY ""
  256. SAY "C-Kermit is designed to work with many different brands of modems."
  257. SAY "Please choose your preferred modem type from the following list:"
  258. SAY ""
  259. SAY " attdtdm            attisn             attmodem           att7300"
  260. SAY " ccitt-v25bis       cermetek           concord            courier"
  261. SAY " df03-ac            df100-series       df200-series       digitel-dt22"
  262. SAY " gdc-212a/ed        hayes              microcom           none"
  263. SAY " penril             pep-telebit        racalvadic         rolm"
  264. SAY " slow-telebit       sportster          telebit            unknown"
  265. SAY " usrobotics-212a    v32-telebit        v42-telebit        ventel"
  266. SAY ""
  267. SAY "Pressing the Enter key by itself selects HAYES..."
  268. IF SUBSTR(OS2Ver, 1, 1 ) > 1
  269.   THEN CALL CHAROUT ,">"
  270. PARSE PULL modem
  271.  
  272. /* Use Hayes if nothing was entered */
  273. IF modem = ""
  274.   THEN modem = "hayes"
  275.  
  276. umodem = TRANSLATE(modem)
  277. IF  (umodem \= "ATTDTDM") & (Umodem \= "ATTISN") & (Umodem \= "ATTMODEM"), 
  278.   & (Umodem \= "ATT7300") & (Umodem \= "CCITT-V25BIS"),
  279.   & (Umodem \= "CERMETEK"),
  280.   & (Umodem \= "CONCORD") & (Umodem \= "COURIER") & (Umodem \= "DF03-AC"),
  281.   & (Umodem \= "DF100-SERIES") & (Umodem \= "DF200-SERIES"),
  282.   & (Umodem \= "DIGITAL-DT22") & (Umodem \= "GDC-212A/ED"),
  283.   & (Umodem \= "HAYES"), 
  284.   & (Umodem \= "MICROCOM") & (Umodem \= "NONE") & (Umodem \= "PENRIL"),
  285.   & (Umodem \= "PEP-TELEBIT") & (Umodem \= "RACALVADIC") & (Umodem \= "ROLM"),
  286.   & (Umodem \= "SLOW-TELEBIT") & (Umodem \= "SPORTSTER"),
  287.   & (Umodem \= "TELEBIT"),
  288.   & (Umodem \= "UNKNOWN") & (Umodem \= "USROBOTICS-212A"),
  289.   & (Umodem \= "V32-TELEBIT"),
  290.   & (Umodem \= "V42-TELEBIT") & (Umodem \= "VENTEL")
  291.   THEN DO
  292.     SAY "'"modem"' is not a valid choice."
  293.     CALL GETMODEM
  294.   END
  295.  
  296. SAY "You have chosen '"modem"' as your default modem."
  297. SAY "Is this correct? (Yes/No):"
  298.  
  299. CALL Confirmation
  300. IF RESULT <> 'Y'
  301.   THEN CALL GETMODEM
  302.  
  303. GETPORT:
  304. SAY ""
  305. SAY "C-Kermit can work with all valid serial communication devices."
  306. SAY "ISA and EISA machines support COM1 through COM4."
  307. SAY "MicroChannel machines support COM1 through COM8."
  308. SAY "However, most computers have only COM1 and COM2 regardless of"
  309. SAY "their architecture."
  310. SAY ""
  311. SAY "Please choose the communications port to which your" modem "modem is"
  312. SAY "connected.  Pressing <Enter> by itself selects COM1..."
  313. IF SUBSTR(OS2Ver, 1, 1 ) > 1
  314.   THEN CALL CHAROUT ,">"
  315. PARSE PULL port
  316.  
  317. /* Use com1 if nothing was entered */
  318. IF port = ""
  319.   THEN port = "com1"
  320.  
  321. IF LENGTH( port ) <> 4 | TRANSLATE( SUBSTR( port, 1, 3 ) ) <> "COM",
  322.   | SUBSTR( port, 4, 1) < 1 | SUBSTR( port, 4, 1 ) > 8
  323.   THEN DO
  324.     SAY "'"port"' is not a valid choice."
  325.     CALL GETPORT
  326.   END
  327.  
  328. SAY "You have chosen '"port"' as your default communications port."
  329. SAY "Is this correct? (Yes/No):"
  330.  
  331. CALL Confirmation
  332. IF RESULT <> 'Y'
  333.   THEN CALL GETPORT
  334.  
  335. GETSPEED:
  336. SAY ""
  337. SAY "C-Kermit can communicate at all hardware-supported transmission"
  338. SAY "speeds.  Please select one of the following speeds, measured in"
  339. SAY "bits per second, as the default speed for port" port || "."
  340. SAY ""
  341. SAY "  50    200   2400   9600   57600"
  342. SAY "  75    300   3600  14400   76800"
  343. SAY " 110    600   4800  19200  115200"
  344. SAY " 150   1200   7200  38400        "
  345. SAY ""
  346. SAY "Pressing <Enter> by itself selects 9600 bps..."
  347. IF SUBSTR(OS2Ver, 1, 1 ) > 1
  348.   THEN CALL CHAROUT ,">"
  349. PARSE PULL speed
  350.  
  351. /* Use 9600 if nothing was entered */
  352. IF speed = ""
  353.   THEN speed = "9600"
  354.  
  355. IF speed <> "50" & speed <> "75" & speed <> "110" & speed <> "150" ,
  356.   & speed <> "200" & speed <> "300" & speed <> "600" & speed <> "1200",
  357.   & speed <> "2400" & speed <> "3600" & speed <> "4800" & speed <> "7200",
  358.   & speed <> "9600" & speed <> "14400" & speed <> "19200" & speed <> "38400",
  359.   & speed <> "57600" & speed <> "76800" & speed <> "115200"
  360.   THEN DO 
  361.     SAY "'"speed"' is not a valid choice."
  362.     CALL GETSPEED
  363.   END
  364.  
  365. SAY "You have chosen '"speed"' as your default transmission speed."
  366. SAY "Is this correct? (Yes/No):"
  367.  
  368. CALL Confirmation
  369. IF RESULT <> 'Y'
  370.   THEN CALL GETSPEED
  371.  
  372. GETRUNMODE:
  373. IF SUBSTR( OS2Ver, 1, 1 ) = "2"
  374.   THEN DO
  375.     SAY ""
  376.     SAY "C-Kermit may be run either in a full screen session or in a window."
  377.     SAY "Full screen sessions are faster, window sessions give you access to"
  378.     SAY "more OS/2 features, like cut and paste.  Please select either:"
  379.     SAY ""
  380.     SAY "  Fullscreen"
  381.     SAY "  Window"
  382.     SAY ""
  383.     SAY "Pressing <Enter> by itself selects Window..."
  384.     IF SUBSTR(OS2Ver, 1, 1 ) > 1
  385.       THEN CALL CHAROUT ,">"
  386.     PARSE PULL runmode
  387.  
  388.     /* Run in a window if nothing was entered */
  389.     IF runmode = ''
  390.       THEN runmode = "Window"
  391.  
  392.     Urunmode = TRANSLATE( runmode )
  393.     IF Urunmode <> "WINDOW"    & Urunmode <> "W" &,
  394.       Urunmode <> "FULLSCREEN" & Urunmode <> "F"
  395.       THEN DO
  396.         SAY "'"runmode"' is not a valid choice."
  397.         CALL GETRUNMODE
  398.       END
  399.  
  400.     IF Urunmode = "W"
  401.       THEN runmode = "Window"
  402.  
  403.     IF Urunmode = "F"
  404.       THEN runmode = "Fullscreen"
  405.  
  406.     SAY "You have chosen to run C-Kermit in a" runmode "session."
  407.     SAY "Is this correct? (Yes/No):"
  408.  
  409.     CALL Confirmation
  410.     IF RESULT <> 'Y'
  411.       THEN CALL GETRUNMODE
  412.     SAY ""
  413.   END
  414.  
  415. /* Start to install files */
  416. /* Copy the READ.ME file first. */
  417. CALL Install 'read.me', 'read.me'
  418.  
  419. CKOVer = 0
  420. IF RexxUtils 
  421.   THEN DO
  422.     CALL SysFileTree "ckoker16.exe", "file", "FO"
  423.     IF file.0 > 0 
  424.       THEN CKOVer = 16
  425.     END
  426.   ELSE DO
  427.     CALL STREAM 'ckoker16.exe', 'c', 'query exists'
  428.     IF "\"RESULT <> "\"
  429.       THEN CKOVer = 16
  430.   END
  431.  
  432. IF RexxUtils
  433.   THEN DO
  434.     CALL SysFileTree "ckoker32.exe", "file", "FO"
  435.     SELECT
  436.       WHEN file.0 > 0 & CKOVer = 16
  437.         THEN CKOVer = "16/32"
  438.  
  439.       WHEN file.0 > 0 & CKOVer = 0
  440.         THEN CKOVer = "32"
  441.  
  442.       OTHERWISE 
  443.         NOP
  444.       END
  445.     END
  446.   ELSE DO
  447.     CALL STREAM 'ckoker32.exe', 'c', 'query exists'
  448.     SELECT
  449.       WHEN "\"RESULT <> "\" & CKOVer = 16
  450.         THEN CKOVer = "16/32"
  451.  
  452.       WHEN "\"RESULT <> "\" & CKOVer = 0
  453.         THEN CKOVer = "32"
  454.  
  455.       OTHERWISE 
  456.         NOP
  457.       END
  458.   END
  459.  
  460. SAY ""
  461. SAY "Installing the C-Kermit application, CKERMIT.EXE..."
  462. SELECT 
  463.   WHEN substr(OS2Ver,1,1) = "1" & (CKOVer = 16 | CKOVer = "16/32")
  464.     THEN DO
  465.       CALL Install 'ckoker16.exe', ckermit.exe
  466.       CALL Install 'ckosysl.ck1', syslevel.cko
  467.     END
  468.           
  469.   WHEN substr(OS2Ver,1,1) = "2" & CKOVer = 16 
  470.     THEN DO
  471.       CALL Install 'ckoker16.exe', ckermit.exe
  472.       CALL Install 'ckosysl.ck1', syslevel.cko
  473.     END
  474.  
  475.   WHEN substr(OS2Ver,1,1) = "2" & (CKOVer = 32 | CKOVer = "16/32")
  476.     THEN DO
  477.       CALL Install 'ckoker32.exe', ckermit.exe
  478.       CALL Install 'ckosysl.ck2', syslevel.cko
  479.     END
  480.  
  481. OTHERWISE
  482.   SAY "Can't install" CKOVer"-bit version of C-Kermit on OS/2 version" OS2Ver
  483.   rc = DIRECTORY( startdir )
  484.   EXIT
  485. END
  486. SAY ""
  487.  
  488. SAY "Installing the C-Kermit Icon..."
  489. CALL Install 'ckoker.ico', 'ckermit.ico'
  490. SAY ""
  491.  
  492. SAY "Installing documentation for recent C-Kermit updates, CKCKER.UPD..."
  493. CALL Install 'ckcker.upd'
  494. SAY ""
  495.  
  496. SAY "Installing the C-Kermit 'beware' files, CKCKER.BWR and CKOKER.BWR..."
  497. CALL Install 'ckcker.bwr'
  498. CALL Install 'ckoker.bwr'
  499. SAY "(Please consult these files for hints and tips if you have problems.)"
  500. SAY ""
  501.  
  502. SAY "Installing the standard C-Kermit initialization file, CKERMIT.INI..."
  503. CALL Install 'ckermit.ini'
  504. SAY ""
  505.  
  506. SAY "Installing your C-Kermit customization file, CKERMOD.INI..."
  507. /*
  508.   Backup ckermod.ini if necessary,
  509.   Read ckermod.ini from diskette,
  510.   write ckermod.ini to dest directory with modifications from previous dialog.
  511. */
  512. CALL Backup 'ckermod.ini'
  513. modini = destination"ckermod.ini"
  514. os2section = 0
  515. LINEIN( "ckermod.ini", 1, 0 )
  516. DO WHILE lines( "ckermod.ini" ) <> 0
  517.   linetxt = LINEIN( "ckermod.ini" )
  518.   upperlinetxt = TRANSLATE(linetxt)
  519.   SELECT
  520.     WHEN (substr( upperlinetxt, 1, 5) = ':OS/2') & (os2section = 0)
  521.       THEN DO
  522.         /* SAY "...Entering OS/2 section" */
  523.         rc = LINEOUT( modini, linetxt )
  524.         os2section = 1
  525.       END
  526.  
  527.     WHEN (substr( upperlinetxt, 1, 9 ) = "SET MODEM") & (os2section = 1)
  528.       THEN rc = LINEOUT( modini, 'set modem' modem )
  529.  
  530.     WHEN (substr( upperlinetxt, 1, 8 ) = "SET PORT") & (os2section = 1)
  531.       THEN rc = LINEOUT( modini, 'set port' port )
  532.  
  533.     WHEN (substr( upperlinetxt, 1, 9 ) = "SET SPEED") & (os2section = 1)
  534.       THEN rc = LINEOUT( modini, 'set speed' speed )
  535.  
  536.     WHEN (substr( upperlinetxt, 1, 3 ) = 'END') & (os2section = 1)
  537.       THEN DO
  538.         /* SAY "...Leaving OS/2 section" */
  539.         rc = LINEOUT( modini, linetxt )
  540.         os2section = 0
  541.       END
  542.  
  543.     OTHERWISE
  544.       rc = LINEOUT( modini, linetxt )
  545.   END
  546. END
  547.  
  548. /* Close files */
  549. rc = STREAM( modini, 'C', 'CLOSE' )
  550. rc = STREAM( "ckermod.ini", 'C', 'CLOSE' )
  551. SAY ""
  552.  
  553. SAY "Installing Sample C-Kermit dialing directory file, CKERMIT.KDD..."
  554. CALL Install 'ckermit.kdd'
  555. SAY ""
  556.  
  557. SAY "Installing sample C-Kermit services directory file, CKERMIT.KSD..."
  558. CALL Install 'ckermit.ksd'
  559. SAY ""
  560.  
  561. SAY "Installing sample C-Kermit startup file, CKERMIT.CMD..."
  562. CALL Install 'ckermit.cmd'
  563. SAY ""
  564.  
  565. SAY "Installing C-Kermit extended keyboard definitions file, CKOVTK.INI..."
  566. CALL Install 'ckovtk.ini'
  567. SAY ""
  568.  
  569. SAY "Installing external protocol hints file, CKOEXP.DOC..."
  570. CALL Install 'ckoexp.doc'
  571. SAY ""
  572.  
  573. SAY "Installing character-set tables CP437.TXT, CP850.TXT, and LATIN1.TXT..."
  574. CALL Install 'cp437.txt'
  575. CALL Install 'cp850.txt'
  576. CALL Install 'latin1.txt'
  577. SAY ""
  578.  
  579. IF RexxUtils
  580.   THEN DO
  581.     SAY "Assigning the C-Kermit icon to" updest || CKERMIT.EXE || "..."
  582.     rc = SysSetIcon( destination || 'ckermit.exe',,
  583.                      destination || 'ckermit.ico' )
  584.     SAY ""
  585.   END
  586.  
  587. /* Build C-Kermit Program Object if version 2.x */
  588. IF RexxUtils & SUBSTR( OS2Ver,1,1 ) = "2" 
  589.   THEN DO
  590.     IF CKOVer = "16"
  591.       THEN title = "OS/2 C-Kermit (16-bit)"
  592.       ELSE title = "OS/2 C-Kermit (32-bit)"
  593.     classname = 'WPProgram'
  594.     location = '<WP_DESKTOP>'
  595.     IF TRANSLATE(runmode) = "WINDOW"
  596.       THEN setup = 'EXENAME='destination'ckermit.exe;STARTUPDIR=',
  597.                    destination';PROGTYPE=WINDOWABLEVIO;'
  598.       ELSE setup = 'EXENAME='destination'ckermit.exe;STARTUPDIR=',
  599.                    destination';PROGTYPE=FULLSCREEN;'
  600.     option = 'update'
  601.  
  602.     SAY "Building C-Kermit Program Object..."
  603.     rc = SysCreateObject(classname, title, location, setup, option)
  604.     SAY ""
  605.   END
  606.  
  607. /* Install dummy TCPIPDLL.DLL if IBM TCP/IP is not installed */
  608. IF tcpip = "0"
  609.   THEN DO
  610.     SAY "Installing dummy TCPIPDLL.DLL for non-TCP/IP OS/2 system..."
  611.     SAY "PLEASE REMEMBER:  If you install IBM TCP/IP at a later date:"
  612.     SAY ""
  613.     SAY "  RENAME or DELETE the file" updest || "TCPIPDLL.DLL."
  614.     SELECT 
  615.       WHEN substr(OS2Ver,1,1) = "1" & (CKOVer = 16 | CKOVer = "16/32")
  616.         THEN CALL Install 'ckotcp16.dll', 'tcpipdll.dll'
  617.           
  618.       WHEN substr(OS2Ver,1,1) = "2" & CKOVer = 16 
  619.         THEN CALL Install 'ckotcp16.dll', 'tcpipdll.dll'
  620.  
  621.       WHEN substr(OS2Ver,1,1) = "2" & (CKOVer = 32 | CKOVer = "16/32")
  622.         THEN CALL Install 'ckotcp32.dll', 'tcpipdll.dll'
  623.  
  624.       OTHERWISE
  625.         SAY "Error installing dummy TCPIPDLL.DLL for non-TCP/IP system."
  626.         rc = DIRECTORY( startdir )
  627.         EXIT
  628.     END
  629.     SAY ""
  630.   END
  631.  
  632. SAY "Your CONFIG.SYS file defines several environment variables that determine"
  633. SAY "how OS/2 and your applications work.  With your permission, this program"
  634. SAY "will modify one or two of them:"
  635. SAY ""
  636. SAY " 1. The C-Kermit directory," destination || ", will be added to your PATH"
  637. SAY "    to allow C-Kermit to be executed from any OS/2 Command Line session."
  638. SAY ""
  639. IF tcpip = 0
  640.   THEN DO
  641.     SAY " 2. The C-Kermit directory," destination || ", will be added to your"
  642.     SAY "    LIBPATH so C-Kermit can work properly on your non-TCP/IP system."
  643.     SAY ""
  644.   END
  645.  
  646. SAY "Please enter 'Yes' to allow this program to update your CONFIG.SYS file."
  647. SAY "A backup copy will be made in the root directory of your boot drive."
  648. SAY "Update CONFIG.SYS? (Yes/No):"
  649.  
  650. CALL Confirmation
  651. IF RESULT <> 'Y'
  652.   THEN DO
  653.     configupdate = 0
  654.     SAY ""
  655.     IF tcpip = 0
  656.       THEN DO
  657.         SAY ""
  658.         SAY "  OK, your CONFIG.SYS file has not been changed, BUT..."
  659.         SAY ""
  660.  
  661.         SAY "    Since you do not appear to have TCP/IP installed, it is"
  662.         SAY "    necessary that the CKOTCP" || CKOVer || ".DLL file be copied"
  663.         SAY "    to a directory named in your LIBPATH statement in CONFIG.SYS,"
  664.         SAY "    and renamed to TCPIPDLL.DLL.  If this is not the case now,"
  665.         SAY "    please be sure to copy this file to a directory that is in"
  666.         SAY "    your LIBPATH."
  667.       END
  668.     ELSE
  669.       SAY "  OK, your CONFIG.SYS file has not been changed."
  670.     CALL Done
  671.   END
  672.  
  673. configupdate = 1
  674. SAY ""
  675.  
  676. /* Back up the existing CONFIG.SYS file. */
  677. IF RexxUtils 
  678.   THEN DO 
  679.     tempname = bootdrive || "\CONFIG.???"
  680.     backup = SysTempFileName( tempname )
  681.     END
  682.   ELSE DO
  683.     n = 100
  684.     backup = bootdrive || "\CONFIG." || n
  685.     CALL STREAM backup, 'c', 'query exists'
  686.     DO WHILE "\"RESULT <> "\"
  687.       n = n + 1
  688.       backup = bootdrive || "\CONFIG." || n
  689.       CALL STREAM backup, 'c', 'query exists'
  690.       END
  691.     END
  692.  
  693. SAY "Backing up CONFIG.SYS to" backup || "..."
  694. copy bootdrive || "\Config.Sys" backup "> NUL"
  695. SAY ""
  696.  
  697. /* Generate a temporary file name for the new CONFIG.SYS file */
  698. IF RexxUtils
  699.   THEN DO
  700.     tempname = bootdrive || "\CONFIG??.INS"
  701.     temp = SysTempFileName( tempname )
  702.     END
  703.   ELSE DO 
  704.     n = 10
  705.     temp = bootdrive || "\CONFIG" || n || ".INS"
  706.     CALL STREAM temp, 'c', 'query exists'
  707.     DO WHILE "\"RESULT <> "\"
  708.       n = n + 1
  709.       temp = bootdrive || "\CONFIG" || n || ".INS"
  710.       CALL STREAM temp, 'c', 'query exists'
  711.       END
  712.     END
  713.  
  714. /* Generate the temporary CONFIG.SYS file. */
  715. SAY "Updating CONFIG.SYS..."
  716. LINEIN( bootdrive || "\Config.sys", 1, 0 )
  717. DO WHILE lines( bootdrive || "\Config.sys" ) <> 0
  718.   linetxt = LINEIN( bootdrive || "\Config.sys" )
  719.   upperlinetxt = TRANSLATE(linetxt)
  720.   SELECT
  721.     WHEN COMPARE( upperlinetxt, "SET PATH" ) = 9 
  722.       THEN DO
  723.         SETLOCAL
  724.         len = LENGTH(linetxt)
  725.         rc = VALUE('PATH', SUBSTR( upperlinetxt, 10, len - 10 ),,
  726.                    'OS2ENVIRONMENT' )
  727.         IF RexxUtils
  728.           THEN ckfound = SysSearchPath( 'PATH', ckermit.exe )
  729.           ELSE ckfound = MySearchPath( 'PATH', ckermit.exe )
  730.         IF ckfound'\' = '\'
  731.           THEN IF SUBSTR( linetxt, len, 1 ) = ';'
  732.             THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' )
  733.             ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' )
  734.           ELSE DO
  735.             ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound )
  736.             IF ckpath = updest
  737.               THEN rc = LINEOUT( temp, linetxt )
  738.               ELSE DO
  739.                 ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 )
  740.                 pos = POS( ckpathnoslash, upperlinetxt )
  741.                 rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) ,
  742.                                     || destnoslash';' ,
  743.                                     || SUBSTR( linetxt, pos, len - pos + 1 ) )
  744.                 SAY ""
  745.                 SAY "  WARNING:"
  746.                 SAY "    An earlier version of 'CKERMIT.EXE' exists in",
  747.                     "    directory" ckpath || "."
  748.                 END
  749.           END
  750.         ENDLOCAL
  751.         END
  752.  
  753. /*
  754.    For future enhancements ...
  755.    (NOTE: This is commented out because it doesn't work yet.)
  756.  
  757.     WHEN COMPARE( upperlinetxt, "SET DPATH" ) = 10
  758.       THEN DO
  759.         SETLOCAL
  760.         len = LENGTH(linetxt)
  761.         rc = VALUE('DPATH', SUBSTR( upperlinetxt, 11, len - 11 ),,
  762.                    'OS2ENVIRONMENT' )
  763.         IF RexxUtils
  764.           THEN ckfound = SysSearchPath( 'DPATH', ckermit.ini )
  765.           ELSE ckfound = MySearchPath( 'DPATH', ckermit.ini )
  766.         IF ckfound'\' = '\'
  767.           THEN IF SUBSTR( linetxt, len, 1 ) = ';'
  768.             THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' )
  769.             ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' )
  770.           ELSE DO
  771.             ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound )
  772.             IF ckpath = updest
  773.               THEN rc = LINEOUT( temp, linetxt )
  774.               ELSE DO
  775.                 ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 )
  776.                 pos = POS( ckpathnoslash, upperlinetxt )
  777.                 rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) ,
  778.                                     || destnoslash';' ,
  779.                                     || SUBSTR( linetxt, pos, len - pos + 1 ) )
  780.                 SAY ""
  781.                 SAY "  WARNING:"
  782.                 SAY "    An earlier version of 'CKERMIT.INI' exists in",
  783.                     "    directory" ckpath || "."
  784.                 END
  785.           END
  786.         ENDLOCAL
  787.         END
  788. */
  789.  
  790.     WHEN (COMPARE( upperlinetxt, "LIBPATH" ) = 8) & (tcpip = 0) 
  791.       THEN DO
  792.         SETLOCAL
  793.         len = LENGTH(linetxt)
  794.         rc = VALUE('LIBPATH', SUBSTR( upperlinetxt, 9, len - 9 ),,
  795.                    'OS2ENVIRONMENT' )
  796.         IF RexxUtils 
  797.           THEN ckfound = SysSearchPath( 'LIBPATH', tcpipdll.dll )
  798.           ELSE ckfound = MySearchPath( 'LIBPATH', tcpipdll.dll )
  799.         IF ckfound'\' = '\'
  800.           THEN IF SUBSTR( linetxt, len, 1 ) = ';'
  801.             THEN rc = LINEOUT( temp, linetxt || destnoslash || ';' )
  802.             ELSE rc = LINEOUT( temp, linetxt || ';' || destnoslash || ';' )
  803.           ELSE DO
  804.             ckpath = FILESPEC('DRIVE', ckfound ) || FILESPEC('PATH', ckfound )
  805.             IF ckpath = updest
  806.               THEN rc = LINEOUT( temp, linetxt )
  807.               ELSE DO
  808.                 ckpathnoslash = SUBSTR( ckpath, 1, LENGTH( ckpath ) - 1 )
  809.                 pos = POS( ckpathnoslash, upperlinetxt )
  810.                 rc = LINEOUT( temp, SUBSTR( linetxt, 1, pos - 1 ) ,
  811.                                     || destnoslash';' ,
  812.                                     || SUBSTR( linetxt, pos, len - pos + 1 ) )
  813.                 SAY ""
  814.                 SAY "  WARNING:"
  815.                 SAY "    An earlier version of 'TCPIPDLL.DLL' exists in",
  816.                     "    directory" ckpath || "."
  817.               END
  818.           END
  819.         ENDLOCAL
  820.         END
  821.  
  822.     OTHERWISE
  823.       rc = LINEOUT( temp, linetxt )
  824.   END
  825. END
  826.  
  827. /* Close files */
  828. rc = STREAM( temp, 'C', 'CLOSE' )
  829. rc = STREAM( bootdrive || "\Config.sys", 'C', 'CLOSE' )
  830.  
  831. COPY temp bootdrive || "\Config.sys > NUL" 
  832. IF RexxUtils 
  833.   THEN rc = SysFileDelete( temp )
  834.   ELSE "CMD /C DEL" temp "> NUL"
  835.  
  836. SAY ""
  837. SAY "  Your CONFIG.SYS file has been updated."
  838. SAY "  Your old CONFIG.SYS has been copied to " backup || "."
  839. SAY "  After reading the following message,"
  840. SAY "  Please Shutdown and Restart OS/2."
  841.  
  842. Done:
  843. SAY ""
  844. SAY "C-Kermit has been successfully installed in the directory" updest || "."
  845. SAY ""
  846. IF SUBSTR( OS2Ver, 1, 1 ) = "2"
  847.   THEN SAY "  To start C-Kermit from the desktop, click on its icon."
  848. IF configupdate
  849.   THEN 
  850.     SAY "  To start C-Kermit from a command window, just type CKERMIT."
  851.   ELSE DO
  852.     SAY "  To start C-Kermit from a command window, just type CKERMIT,"
  853.     SAY "  or if" updest "is not in your PATH, type" updest || "CKERMIT."
  854.     END
  855. SAY ""
  856. SAY "Please consult the book 'Using C-Kermit' for complete instructions, and"
  857. SAY "also read the update and beware files in " updest "for other important"
  858. SAY "information:  CKCKER.UPD, CKCKER.BWR, and CKOKER.BWR.  If you don't have"
  859. SAY "the book, call +1 212 854-3703 (USA) to order."
  860. SAY ""
  861. IF RexxUtils
  862.   THEN DO 
  863.     SAY "Press any key to exit from the C-Kermit installation procedure."
  864.     PARSE UPPER VALUE SysGetKey('NOECHO') WITH confirm
  865.     END
  866.   ELSE DO
  867.     SAY "Press <Enter> to exit from the C-kermit installation procedure."
  868.     IF SUBSTR(OS2Ver, 1, 1 ) > 1
  869.       THEN CALL CHAROUT ,">"
  870.     PARSE PULL dummy
  871.     END
  872. rc = DIRECTORY( startdir )
  873. EXIT
  874.  
  875. Install:
  876. IF "\"ARG(2) = "\"
  877.   THEN destname = ARG(1)
  878.   ELSE destname = ARG(2) 
  879. CALL Backup destname
  880. COPY ARG(1) destination || destname "> NUL"
  881. RETURN
  882.  
  883. Backup:
  884. IF RexxUtils
  885.   THEN DO 
  886.     CALL SysFileTree destination || ARG(1), 'file', 'FO'
  887.     IF file.0 > 0
  888.       THEN DO
  889.         CALL SysFileTree destination || 'BACKUP', 'dir', 'DO'
  890.         IF dir.0 = 0
  891.           THEN CALL SysMkDir destination || 'BACKUP'
  892.  
  893.         CALL SysFileTree destination || 'BACKUP\' || ARG(1), 'file', 'FO'
  894.         IF file.0 > 0
  895.           THEN CALL SysFileDelete destination || 'BACKUP\' || ARG(1)
  896.  
  897.         COPY destination || ARG(1) destination || 'BACKUP\' || ARG(1) '> NUL'
  898.         CALL SysFileDelete destination || ARG(1)
  899.       END 
  900.     END
  901.   ELSE DO
  902.     CALL STREAM destination || ARG(1), 'c', 'query exists'
  903.     IF "\"RESULT <> "\"
  904.       THEN DO
  905.     "CMD /C DIR" destination || "BACKUP > NUL"
  906.         IF RC <> 0
  907.           THEN 'CMD /C MD' destination || 'BACKUP > NUL'
  908.  
  909.         CALL STREAM destination || "BACKUP\" || ARG(1), 'c', 'query exists'
  910.         IF "\"RESULT <> "\"
  911.           THEN "CMD /C DEL" destination || "BACKUP\" || ARG(1) "> NUL"
  912.  
  913.       COPY destination || ARG(1) destination || 'BACKUP\' || ARG(1) '> NUL'
  914.     "CMD /C DEL" destination || ARG(1)
  915.         END
  916.     END
  917. RETURN
  918.  
  919. Confirmation:
  920. retval = ""
  921. DO WHILE retval = ""
  922.   IF SUBSTR(OS2Ver, 1, 1 ) > 1
  923.     THEN CALL CHAROUT ,">"
  924.   PARSE PULL response
  925.   SELECT
  926.     WHEN ( TRANSLATE( response ) = 'N' | TRANSLATE( response ) = 'NO' )
  927.       THEN retval = 'N'
  928.  
  929.     WHEN ( TRANSLATE( response ) = 'Y' | TRANSLATE( response ) = 'YES' )
  930.       THEN retval = 'Y'
  931.  
  932.     OTHERWISE
  933.       SAY ""
  934.       SAY "Invalid response.  Please type Y or Yes or N or No."
  935.   END
  936. END
  937. RETURN retval
  938.  
  939.  
  940. /* This procedure duplicates as best as possible the RexxUtil function 
  941.    SysSearchPath.                                                       */
  942. MySearchPath: PROCEDURE ;
  943. _path = VALUE( ARG(1), , "OS2ENVIRONMENT" )
  944. IF SUBSTR( _path, LENGTH(_path), 1 ) <> ";"
  945.   THEN _path = _path || ";"
  946. PARSE UPPER VAR _path _dir ";" _path
  947. DO WHILE ("\"_dir <> "\") | ("\"_path <> "\")
  948.   CALL STREAM _dir || "\" || ARG(2), 'c', 'query exists'
  949.   IF "\"RESULT <> "\"
  950.     THEN RETURN _dir || "\" || ARG(2)
  951.     ELSE PARSE UPPER VAR _path _dir ";" _path
  952.   END
  953. RETURN ""
  954.  
  955. /* End OS/2 C-Kermit INSTALL.CMD */
  956.